package com.hu.web.controller.business;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hu.common.annotation.Log;
import com.hu.common.core.controller.BaseController;
import com.hu.common.enums.BusinessType;
import com.hu.system.domain.ProductAnalysis;
import com.hu.system.service.IProductAnalysisService;
import com.hu.common.utils.poi.ExcelUtil;
import com.hu.common.core.page.TableDataInfo;

/**
 * 产品分析Controller
 *
 * @author hu
 * @date 2025-01-22
 */
@RestController
@RequestMapping("/business/analysis/product")
public class ProductAnalysisController extends BaseController {
    @Autowired
    private IProductAnalysisService productAnalysisService;

    /**
     * 查询产品分析列表
     */
    @PreAuthorize("@ss.hasPermi('analysis:product:list')")
    @GetMapping("/list")
    public TableDataInfo list(ProductAnalysis productAnalysis) {
        startPage();
        List<ProductAnalysis> list = productAnalysisService.selectProductAnalysisList(productAnalysis);
        return getDataTable(list);
    }

    /**
     * 导出产品分析列表
     */
    @PreAuthorize("@ss.hasPermi('analysis:product:export')")
    @Log(title = "产品分析", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProductAnalysis productAnalysis) {
        List<ProductAnalysis> list = productAnalysisService.selectProductAnalysisList(productAnalysis);
        ExcelUtil<ProductAnalysis> util = new ExcelUtil<ProductAnalysis>(ProductAnalysis.class);
        util.exportExcel(response, list, "产品分析数据");
    }
}

